﻿using System;
using System.ServiceModel;
using System.Windows;
using Client.Wpf.ViewModels;
using Service.Contract;

namespace Client.Wpf
{
  /// <summary>
  ///   Interaction logic for MainWindow.xaml
  /// </summary>
  public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();
      DataContext = new MainWindowVM();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
      var channelFactory =
        new ChannelFactory<IHelloService>("webRelay");
      IHelloService channel = channelFactory.CreateChannel();

      for (int i = 0; i < 10; i++)
      {
        string response = channel.SayHello("Service Bus");
        Console.WriteLine(response);
      }

      channelFactory.Close();
    }
  }
}